<template>
	<view class="topBox">
		<h1 class="title" >体重</h1>
		<view class="textBox">
			{{msg}} 
		</view>
		<view class="btmBox">
			<view class="weiBox" >
				<text >{{weight}}</text>
				<text style="font-size: 28px;">kg</text>
			</view>
			
			<sliderChoose @input="getData" ></sliderChoose>
		</view>
		<view style="width: 70%;height: 6vh;margin: 0 auto;" class="btnBox">
			<view @click="goWelcome()" style="width: 40%;height: 100%;float: left;border: 2px solid rgba(227, 227, 227, 1);border-radius: 48px;text-align: center;">
				<span style="font-size: 20px;color: rgba(133, 133, 133, 1);font-weight: 400;line-height: 6vh;">跳过</span>
			</view>
			<view @click="goBodyHeight()" style="width: 40%;height: 100%;float: right;background: linear-gradient(90deg, rgba(146, 163, 253, 1) 0%, rgba(157, 206, 255, 1) 100%);border-radius: 48px;text-align: center;">
				<span style="font-size: 20px;color: rgba(255, 255, 255, 1);font-weight: 400;line-height: 6vh;">确定</span>
			</view>
		</view>
	</view>
</template>

<script>
	import sliderChoose from '@/components/dlm-slide-choose/dlm-slide-choose.vue';
	export default {
		components: {
			sliderChoose,
		},
		data(){
			return {
				userInfo:{},
				msg:"身高体重不同，热量消耗也有所不同，完善个人信息，运动后可获取更精确的运动消耗",
				weight:30,
			}
		},
		created() {
			this.userInfo=uni.getStorageSync('userInfo')
		},
		methods:{
			//跳过
			goWelcome(){
				uni.navigateTo({
					url: '/pages/student/chooseLabel/welcome',
					animationType: 'slide-out-top',
					animationDuration: 200
				})
			},
			getData(value){
				this.weight=30+value
			},
			goBodyHeight () {
				this.userInfo.memberUserWeight=this.weight
				uni.setStorageSync('userInfo',this.userInfo)
				uni.request({
					url: "http://127.0.0.1:17000/memberUser/updateMemberInfoById",
					method: "POST",
					data:this.userInfo,
					success: (res) => {
						if (res.data.code == 200) {
							console.log("成功了")
						}
					}
				})
				if(uni.getStorageSync('userInfo').memberUserHeight==null){
					uni.navigateTo({
						url: '/pages/student/chooseLabel/bodyHeight',
						animationType: 'slide-out-top',
						animationDuration: 200
					})
				}else{
					uni.navigateTo({
						url: '/pages/student/chooseLabel/welcome',
						animationType: 'slide-out-top',
						animationDuration: 200
					})
				}
				
			},
		}
	}
</script>

<style>
	.topBox{
		height: 90vh;
		width:90%;
		text-align: center;
		margin-left: 5%;
	}
	.textBox{
		font-size: 18px;
		color: gray;
		margin-top: 7%;
	}
	.title{
		font-size: 36px;
		margin-top: 10%;
		font-weight: 700;
	}
	.btmBox{
		margin-top: 30%;
	}
	.weiBox{
		color: aqua;
		font-size: 60px;
		margin-bottom: 10%;
		display: inline-block
	}
	.btnBox{
		position: fixed;
		bottom: 6%;
		left:15%
	}
</style>